<?php

class Claslist extends Controller
{
	function Claslist()
	{
		parent::Controller();
		$this->load->helper('string');
		$this->load->helper('url');
        $this->load->helper('form');
        $this->load->helper('email');
	}
	
	
	
	function index()
	{						
	}	
	
	
	
	function findclasses($imie, $nazwisko)
	{
		
		if(NULL ==  getenv('HTTP_REFERER'))
		{
			echo "NASTĄPIŁA PRÓBA WYŁUDZENIA INFORMACJI !";
		}
		else
		{
		
			$query = "SELECT s.name AS przedmiot, c.name AS klasa FROM teachers t, subjects_teachers st, classes c, subjects s WHERE t.id = st.teacher_id AND c.id = st.classe_id AND 
				 	s.id = st.subject_id AND t.firstname ='" . $imie . "' AND t.secondname = '" . $nazwisko . "' ORDER BY s.name, c.name";
		
			$query = $this->db->query($query);
		
		
			$table = array('zapytanie' => $query, 'imie' => $imie, 'nazwisko' => $nazwisko); 
			$this->load->view("claslist_view", $table);
		}	
	}
}

?>